package cn.lyjuan.first.netty.demo._2_netty;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.util.concurrent.*;

public class Bootstrap
{
    public static void init(NIOPool pool, int port) throws IOException
    {
        // server channel
        ServerSocketChannel chl = ServerSocketChannel.open();
        chl.configureBlocking(false);
        chl.socket().bind(new InetSocketAddress(port));

        // register accept selector
        pool.nextBoss().register(chl);

        System.out.println("server start");
    }
}
